﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Core;
using SmartSapce.ServiceLocation;

namespace SmartSpace.WebApp._console.core
{
    public partial class role_add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void _ctlBtnSave_Click(object sender, EventArgs e)
        {
            Role role = new Role();
            role.Id = Guid.NewGuid();
            role.Code = _ctlEditName.Text;
            role.Caption = _ctlEditCaption.Text;
            role.CreatedTime = DateTime.Now;
            role.Module = "SYS";
            role.Type = RoleType.System;

            ICoreService service = ServiceLocator.Get<ICoreService>();
            if (service.SaveRole(role))
            {
                Response.Redirect(_ctlLinkBack.NavigateUrl);
            }
        }
    }
}